fix(mcp-apps): update ui/message to use ContentBlock[] for content#6546
Merged
angiejones merged 3 commits intomainfrom Jan 17, 2026
Merged
fix(mcp-apps): update ui/message to use ContentBlock[] for content#6546angiejones merged 3 commits intomainfrom
angiejones merged 3 commits intomainfrom
Conversation
The MCP Apps draft spec (SEP-1865) has been in flux regarding the
ui/message params.content type. After discussion with the spec authors,
the agreed format is ContentBlock[] (array of content blocks) rather
than a single ContentBlock object.
This change:
- Updates McpMethodParams['ui/message'] to expect content as ContentBlock[]
- Adds ContentBlock type supporting text, image, and resource blocks
- Updates the handler to extract text from the first text block in the array
- Returns empty object {} on success per the spec
Related spec discussions:
- modelcontextprotocol/ext-apps#48
- modelcontextprotocol/ext-apps#119
- MCP-UI-Org/mcp-ui#166
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the MCP Apps ui/message handler where it was crashing when trying to access content.text on an array. The spec has been clarified to use ContentBlock[] instead of a single content object, and this PR updates both the types and handler implementation accordingly.
Changes:
- Updated
ui/messagetype definitions to useContentBlock[]array with support for text, image, and resource blocks - Modified handler to validate array format and extract text from the first text block
- Changed response type from status object to empty object per spec
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ui/desktop/src/components/McpApps/types.ts | Added ContentBlock type union and updated ui/message params/response types |
| ui/desktop/src/components/McpApps/McpAppRenderer.tsx | Updated handler to process ContentBlock array and extract text content |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
angiejones
approved these changes
Jan 17, 2026
fbalicchia
pushed a commit
to fbalicchia/goose
that referenced
this pull request
Jan 23, 2026
…lock#6546) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: fbalicchia <fbalicchia@cuebiq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug where the
ui/messagehandler was crashing withTypeError: Cannot read properties of undefined (reading 'trim')when MCP Apps sent messages.Problem
The MCP Apps draft spec (SEP-1865) has been in flux regarding the
ui/messageparams.contenttype. The written documentation showedcontentas a single object:But MCP Apps were actually sending
contentas an array (this will the standard going forward):Our code was trying to access
content.textdirectly, which wasundefinedbecausecontentwas an array.Resolution
After discussion with the spec authors, the agreed format going forward is
ContentBlock[](array of content blocks):Changes
types.ts:ContentBlocktype supportingtext,image, andresourceblock typesMcpMethodParams['ui/message']to use{ role: 'user'; content: ContentBlock[] }McpMethodResponse['ui/message']to return empty object{}per specMcpAppRenderer.tsx:contentis an arrayTesting